<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理 - 1024导航</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.8/dist/chart.umd.min.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        accent: '#F59E0B',
                        dark: '#1F2937',
                        light: '#F9FAFB',
                        danger: '#EF4444',
                        warning: '#F59E0B',
                        info: '#3B82F6'
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .sidebar-active {
                @apply bg-primary/10 text-primary border-l-4 border-primary;
            }
            .stat-card {
                @apply bg-white rounded-xl shadow-sm p-5 transition-all duration-300 hover:shadow-md;
            }
            .table-row-hover {
                @apply hover:bg-gray-50 transition-colors;
            }
        }
    </style>
</head>

<body class="bg-gray-50 font-sans text-gray-800 flex h-screen overflow-hidden">
    <!-- 侧边栏导航 -->
    <aside class="w-64 bg-white shadow-sm h-full border-r border-gray-200 flex-shrink-0 hidden md:block">
        <div class="p-5 border-b border-gray-200">
            <div class="text-primary text-xl font-bold">1024<span class="text-secondary">导航</span></div>
            <p class="text-xs text-gray-500 mt-1">管理员后台</p>
        </div>

        <nav class="p-4">
            <p class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 px-3">主菜单</p>
            <ul class="space-y-1">
                <li>
                    <a href="#" class="sidebar-active flex items-center px-3 py-3 text-sm rounded-md">
                        <i class="fa fa-tachometer w-5 text-center mr-3"></i>
                        <span>控制台</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-th-large w-5 text-center mr-3"></i>
                        <span>资源管理</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-wrench w-5 text-center mr-3"></i>
                        <span>工具管理</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-users w-5 text-center mr-3"></i>
                        <span>用户管理</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-comments w-5 text-center mr-3"></i>
                        <span>社区内容</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-bar-chart w-5 text-center mr-3"></i>
                        <span>数据统计</span>
                    </a>
                </li>
            </ul>

            <p class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 px-3 mt-8">系统设置</p>
            <ul class="space-y-1">
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-cog w-5 text-center mr-3"></i>
                        <span>网站设置</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-shield w-5 text-center mr-3"></i>
                        <span>安全设置</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-bell w-5 text-center mr-3"></i>
                        <span>通知管理</span>
                    </a>
                </li>
                <li>
                    <a href="#"
                        class="flex items-center px-3 py-3 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors">
                        <i class="fa fa-history w-5 text-center mr-3"></i>
                        <span>操作日志</span>
                    </a>
                </li>
            </ul>
        </nav>
    </aside>

    <!-- 主内容区 -->
    <div class="flex-1 flex flex-col overflow-hidden">
        <!-- 顶部导航 -->
        <header class="bg-white shadow-sm h-16 border-b border-gray-200 flex items-center justify-between px-6">
            <div class="flex items-center">
                <button class="md:hidden mr-4 text-gray-600">
                    <i class="fa fa-bars text-xl"></i>
                </button>
                <h1 class="text-lg font-semibold">控制台</h1>
            </div>

            <div class="flex items-center space-x-4">
                <div class="relative">
                    <button class="text-gray-600 hover:text-primary transition-colors relative">
                        <i class="fa fa-bell text-xl"></i>
                        <span
                            class="absolute -top-1 -right-1 w-4 h-4 bg-danger rounded-full text-white text-xs flex items-center justify-center">3</span>
                    </button>
                </div>

                <div class="relative group">
                    <button class="flex items-center space-x-2">
                        <img src="https://picsum.photos/id/1005/40/40" alt="管理员头像"
                            class="w-8 h-8 rounded-full object-cover">
                        <span class="text-sm font-medium hidden md:inline-block">管理员</span>
                        <i class="fa fa-angle-down text-gray-500"></i>
                    </button>
                    <div
                        class="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg py-2 z-10 hidden group-hover:block">
                        <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">个人资料</a>
                        <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">账号设置</a>
                        <div class="border-t border-gray-100 my-1"></div>
                        <a href="#" class="block px-4 py-2 text-sm text-red-600 hover:bg-gray-100">退出登录</a>
                    </div>
                </div>
            </div>
        </header>

        <!-- 页面内容 -->
        <main class="flex-1 overflow-y-auto p-6 bg-gray-50">
            <!-- 统计卡片 -->
            <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
                <div class="stat-card">
                    <div class="flex items-center justify-between mb-4">
                        <p class="text-gray-500 text-sm">总资源数</p>
                        <div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary">
                            <i class="fa fa-th-large"></i>
                        </div>
                    </div>
                    <div class="flex items-end justify-between">
                        <div>
                            <h3 class="text-2xl font-bold">1,284</h3>
                            <p class="text-secondary text-xs flex items-center mt-1">
                                <i class="fa fa-arrow-up mr-1"></i> 12% 较上月
                            </p>
                        </div>
                    </div>
                </div>

                <div class="stat-card">
                    <div class="flex items-center justify-between mb-4">
                        <p class="text-gray-500 text-sm">活跃用户</p>
                        <div
                            class="w-10 h-10 rounded-full bg-secondary/10 flex items-center justify-center text-secondary">
                            <i class="fa fa-users"></i>
                        </div>
                    </div>
                    <div class="flex items-end justify-between">
                        <div>
                            <h3 class="text-2xl font-bold">8,642</h3>
                            <p class="text-secondary text-xs flex items-center mt-1">
                                <i class="fa fa-arrow-up mr-1"></i> 8% 较上月
                            </p>
                        </div>
                    </div>
                </div>

                <div class="stat-card">
                    <div class="flex items-center justify-between mb-4">
                        <p class="text-gray-500 text-sm">今日访问量</p>
                        <div class="w-10 h-10 rounded-full bg-accent/10 flex items-center justify-center text-accent">
                            <i class="fa fa-eye"></i>
                        </div>
                    </div>
                    <div class="flex items-end justify-between">
                        <div>
                            <h3 class="text-2xl font-bold">3,254</h3>
                            <p class="text-danger text-xs flex items-center mt-1">
                                <i class="fa fa-arrow-down mr-1"></i> 3% 较昨日
                            </p>
                        </div>
                    </div>
                </div>

                <div class="stat-card">
                    <div class="flex items-center justify-between mb-4">
                        <p class="text-gray-500 text-sm">待审核资源</p>
                        <div class="w-10 h-10 rounded-full bg-danger/10 flex items-center justify-center text-danger">
                            <i class="fa fa-clock-o"></i>
                        </div>
                    </div>
                    <div class="flex items-end justify-between">
                        <div>
                            <h3 class="text-2xl font-bold">24</h3>
                            <p class="text-danger text-xs flex items-center mt-1">
                                <i class="fa fa-arrow-up mr-1"></i> 5 较昨日
                            </p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 图表和最近数据 -->
            <div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
                <div class="lg:col-span-2 bg-white rounded-xl shadow-sm p-6">
                    <div class="flex justify-between items-center mb-6">
                        <h2 class="font-bold text-lg">平台访问趋势</h2>
                        <div class="flex space-x-2">
                            <button class="px-3 py-1 text-xs bg-primary text-white rounded-md">周</button>
                            <button
                                class="px-3 py-1 text-xs bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 transition-colors">月</button>
                            <button
                                class="px-3 py-1 text-xs bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 transition-colors">年</button>
                        </div>
                    </div>
                    <div class="h-80">
                        <canvas id="visitsChart"></canvas>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-sm p-6">
                    <div class="flex justify-between items-center mb-6">
                        <h2 class="font-bold text-lg">资源分类占比</h2>
                        <button class="text-gray-500 hover:text-primary transition-colors">
                            <i class="fa fa-ellipsis-v"></i>
                        </button>
                    </div>
                    <div class="h-64 mb-6">
                        <canvas id="categoriesChart"></canvas>
                    </div>
                    <div class="space-y-3">
                        <div class="flex items-center justify-between">
                            <div class="flex items-center">
                                <div class="w-3 h-3 rounded-full bg-primary mr-2"></div>
                                <span class="text-sm">开发工具</span>
                            </div>
                            <span class="text-sm font-medium">35%</span>
                        </div>
                        <div class="flex items-center justify-between">
                            <div class="flex items-center">
                                <div class="w-3 h-3 rounded-full bg-secondary mr-2"></div>
                                <span class="text-sm">学习教育</span>
                            </div>
                            <span class="text-sm font-medium">25%</span>
                        </div>
                        <div class="flex items-center justify-between">
                            <div class="flex items-center">
                                <div class="w-3 h-3 rounded-full bg-accent mr-2"></div>
                                <span class="text-sm">设计资源</span>
                            </div>
                            <span class="text-sm font-medium">20%</span>
                        </div>
                        <div class="flex items-center justify-between">
                            <div class="flex items-center">
                                <div class="w-3 h-3 rounded-full bg-purple-500 mr-2"></div>
                                <span class="text-sm">其他资源</span>
                            </div>
                            <span class="text-sm font-medium">20%</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 待处理事项和最近活动 -->
            <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                <!-- 待审核资源 -->
                <div class="bg-white rounded-xl shadow-sm overflow-hidden">
                    <div class="p-6 border-b border-gray-100">
                        <div class="flex justify-between items-center">
                            <h2 class="font-bold text-lg">待审核资源</h2>
                            <a href="#" class="text-primary text-sm hover:underline">查看全部</a>
                        </div>
                    </div>
                    <div class="divide-y divide-gray-100">
                        <div class="p-4 table-row-hover">
                            <div class="flex items-start">
                                <div
                                    class="w-10 h-10 rounded-lg bg-blue-100 flex items-center justify-center text-primary mr-3 flex-shrink-0">
                                    <i class="fa fa-code"></i>
                                </div>
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">在线API测试工具</h3>
                                    <p class="text-gray-500 text-sm mt-1">提交者: user12345 · 2小时前</p>
                                </div>
                                <div class="flex-shrink-0 ml-2">
                                    <div class="flex space-x-2">
                                        <button
                                            class="text-xs px-2 py-1 bg-secondary text-white rounded hover:bg-secondary/90 transition-colors">通过</button>
                                        <button
                                            class="text-xs px-2 py-1 bg-danger text-white rounded hover:bg-danger/90 transition-colors">拒绝</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="p-4 table-row-hover">
                            <div class="flex items-start">
                                <div
                                    class="w-10 h-10 rounded-lg bg-purple-100 flex items-center justify-center text-purple-600 mr-3 flex-shrink-0">
                                    <i class="fa fa-paint-brush"></i>
                                </div>
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">免费图标下载网站</h3>
                                    <p class="text-gray-500 text-sm mt-1">提交者: designer88 · 5小时前</p>
                                </div>
                                <div class="flex-shrink-0 ml-2">
                                    <div class="flex space-x-2">
                                        <button
                                            class="text-xs px-2 py-1 bg-secondary text-white rounded hover:bg-secondary/90 transition-colors">通过</button>
                                        <button
                                            class="text-xs px-2 py-1 bg-danger text-white rounded hover:bg-danger/90 transition-colors">拒绝</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="p-4 table-row-hover">
                            <div class="flex items-start">
                                <div
                                    class="w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center text-amber-600 mr-3 flex-shrink-0">
                                    <i class="fa fa-graduation-cap"></i>
                                </div>
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">Python数据分析教程</h3>
                                    <p class="text-gray-500 text-sm mt-1">提交者: learn2code · 昨天</p>
                                </div>
                                <div class="flex-shrink-0 ml-2">
                                    <div class="flex space-x-2">
                                        <button
                                            class="text-xs px-2 py-1 bg-secondary text-white rounded hover:bg-secondary/90 transition-colors">通过</button>
                                        <button
                                            class="text-xs px-2 py-1 bg-danger text-white rounded hover:bg-danger/90 transition-colors">拒绝</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 最近用户 -->
                <div class="bg-white rounded-xl shadow-sm overflow-hidden">
                    <div class="p-6 border-b border-gray-100">
                        <div class="flex justify-between items-center">
                            <h2 class="font-bold text-lg">最近注册用户</h2>
                            <a href="#" class="text-primary text-sm hover:underline">查看全部</a>
                        </div>
                    </div>
                    <div class="divide-y divide-gray-100">
                        <div class="p-4 table-row-hover">
                            <div class="flex items-center">
                                <img src="https://picsum.photos/id/1012/40/40" alt="用户头像"
                                    class="w-10 h-10 rounded-full object-cover mr-3">
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">李小明</h3>
                                    <p class="text-gray-500 text-sm">user_lixm@example.com</p>
                                </div>
                                <span class="text-xs bg-green-100 text-green-800 px-2 py-0.5 rounded-full">普通用户</span>
                            </div>
                        </div>
                        <div class="p-4 table-row-hover">
                            <div class="flex items-center">
                                <img src="https://picsum.photos/id/1027/40/40" alt="用户头像"
                                    class="w-10 h-10 rounded-full object-cover mr-3">
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">张小红</h3>
                                    <p class="text-gray-500 text-sm">zhangxh88@example.com</p>
                                </div>
                                <span class="text-xs bg-green-100 text-green-800 px-2 py-0.5 rounded-full">普通用户</span>
                            </div>
                        </div>
                        <div class="p-4 table-row-hover">
                            <div class="flex items-center">
                                <img src="https://picsum.photos/id/1025/40/40" alt="用户头像"
                                    class="w-10 h-10 rounded-full object-cover mr-3">
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">王大力</h3>
                                    <p class="text-gray-500 text-sm">wangdl@example.com</p>
                                </div>
                                <span class="text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full">内容贡献者</span>
                            </div>
                        </div>
                        <div class="p-4 table-row-hover">
                            <div class="flex items-center">
                                <img src="https://picsum.photos/id/1074/40/40" alt="用户头像"
                                    class="w-10 h-10 rounded-full object-cover mr-3">
                                <div class="flex-1 min-w-0">
                                    <h3 class="font-medium text-gray-800 truncate">赵小丽</h3>
                                    <p class="text-gray-500 text-sm">zhaoxl@example.com</p>
                                </div>
                                <span class="text-xs bg-green-100 text-green-800 px-2 py-0.5 rounded-full">普通用户</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 最近活动 -->
                <div class="bg-white rounded-xl shadow-sm overflow-hidden">
                    <div class="p-6 border-b border-gray-100">
                        <div class="flex justify-between items-center">
                            <h2 class="font-bold text-lg">最近活动</h2>
                            <a href="#" class="text-primary text-sm hover:underline">查看日志</a>
                        </div>
                    </div>
                    <div class="p-4">
                        <div class="space-y-4">
                            <div class="flex">
                                <div class="mr-4 flex-shrink-0">
                                    <div
                                        class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center text-green-600">
                                        <i class="fa fa-check"></i>
                                    </div>
                                </div>
                                <div>
                                    <p class="text-sm">资源「前端开发手册」已通过审核</p>
                                    <p class="text-gray-500 text-xs mt-1">1小时前</p>
                                </div>
                            </div>
                            <div class="flex">
                                <div class="mr-4 flex-shrink-0">
                                    <div
                                        class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center text-blue-600">
                                        <i class="fa fa-user-plus"></i>
                                    </div>
                                </div>
                                <div>
                                    <p class="text-sm">新用户「李小明」注册成功</p>
                                    <p class="text-gray-500 text-xs mt-1">3小时前</p>
                                </div>
                            </div>
                            <div class="flex">
                                <div class="mr-4 flex-shrink-0">
                                    <div
                                        class="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center text-red-600">
                                        <i class="fa fa-times"></i>
                                    </div>
                                </div>
                                <div>
                                    <p class="text-sm">资源「免费影视网站」未通过审核</p>
                                    <p class="text-gray-500 text-xs mt-1">5小时前</p>
                                </div>
                            </div>
                            <div class="flex">
                                <div class="mr-4 flex-shrink-0">
                                    <div
                                        class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center text-purple-600">
                                        <i class="fa fa-comment"></i>
                                    </div>
                                </div>
                                <div>
                                    <p class="text-sm">新评论「这个工具非常实用！」已发布</p>
                                    <p class="text-gray-500 text-xs mt-1">昨天</p>
                                </div>
                            </div>
                            <div class="flex">
                                <div class="mr-4 flex-shrink-0">
                                    <div
                                        class="w-8 h-8 rounded-full bg-amber-100 flex items-center justify-center text-amber-600">
                                        <i class="fa fa-download"></i>
                                    </div>
                                </div>
                                <div>
                                    <p class="text-sm">工具「在线PDF转换」下载量突破1000次</p>
                                    <p class="text-gray-500 text-xs mt-1">昨天</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // 初始化图表
        document.addEventListener('DOMContentLoaded', function () {
            // 访问趋势图表
            const visitsCtx = document.getElementById('visitsChart').getContext('2d');
            const visitsChart = new Chart(visitsCtx, {
                type: 'line',
                data: {
                    labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
                    datasets: [{
                        label: '访问量',
                        data: [2800, 3200, 3600, 3100, 4200, 5100, 4800],
                        borderColor: '#3B82F6',
                        backgroundColor: 'rgba(59, 130, 246, 0.1)',
                        tension: 0.4,
                        fill: true
                    }, {
                        label: '活跃用户',
                        data: [1200, 1400, 1600, 1300, 1800, 2200, 2000],
                        borderColor: '#10B981',
                        backgroundColor: 'rgba(16, 185, 129, 0.1)',
                        tension: 0.4,
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'top',
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });

            // 分类占比图表
            const categoriesCtx = document.getElementById('categoriesChart').getContext('2d');
            const categoriesChart = new Chart(categoriesCtx, {
                type: 'doughnut',
                data: {
                    labels: ['开发工具', '学习教育', '设计资源', '其他资源'],
                    datasets: [{
                        data: [35, 25, 20, 20],
                        backgroundColor: [
                            '#3B82F6',
                            '#10B981',
                            '#F59E0B',
                            '#8B5CF6'
                        ],
                        borderWidth: 0
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    cutout: '70%',
                    plugins: {
                        legend: {
                            display: false
                        }
                    }
                }
            });
        });

        // 移动端侧边栏切换
        const menuButton = document.querySelector('button.md\\:hidden');
        const sidebar = document.querySelector('aside');

        menuButton.addEventListener('click', function () {
            sidebar.classList.toggle('hidden');
            sidebar.classList.toggle('fixed');
            sidebar.classList.toggle('z-50');
            sidebar.classList.toggle('w-64');
        });
    </script>
</body>

</html>